home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / processes / procdoggie / stubldef / stubldef.p next >
Encoding:
Text File  |  2000-09-28  |  2.1 KB  |  71 lines

  1. UNIT StubLDEF;
  2.  
  3. (*
  4.     File:        StubLDEF.p
  5.  
  6.     Contains:    An LDEF that simply routes the call through the list's
  7.                 refCon, thereby allowing us to have the actual code in
  8.                 the main body of the application.
  9.  
  10.     Written by:    Forrest Tanaka
  11.  
  12.     Copyright:    © 1988-1997 by Apple Computer, Inc., all rights reserved.
  13.  
  14.     Change History (most recent first):
  15.  
  16.     You may incorporate this sample code into your applications without
  17.     restriction, though the sample code has been provided "AS IS" and the
  18.     responsibility for its operation is 100% yours.  However, what you are
  19.     not permitted to do is to redistribute the source as "DSC Sample Code"
  20.     after having made changes. If you're going to re-distribute the source,
  21.     we require that you make it clear in the source that the code was
  22.     descended from Apple Sample Code, but that you've made changes.
  23. *)
  24.  
  25. INTERFACE
  26.  
  27.     USES
  28.         Types,
  29.         Lists;
  30.         
  31. {$main}
  32.     PROCEDURE StubLDEF (message:    Integer;
  33.                            selectCell: Boolean;
  34.                            cellRect:   Rect;
  35.                            theCell:    Cell;
  36.                            dataOffset: Integer;
  37.                            dataLength: Integer;
  38.                            theList:    ListHandle);
  39.  
  40. IMPLEMENTATION
  41.  
  42.     PROCEDURE CallProc (message:    Integer;
  43.                            selectCell: Boolean;
  44.                            cellRect:   Rect;
  45.                            theCell:    Cell;
  46.                            dataOffset: Integer;
  47.                            dataLength: Integer;
  48.                            theList:    ListHandle;
  49.                            proc:       ProcPtr);
  50.         INLINE
  51.             $205F,            (* move.l    (sp)+,a0    *)
  52.             $4E90;            (* jmp        (a0)        *)
  53.  
  54.     PROCEDURE StubLDEF (message:    Integer;
  55.                            selectCell: Boolean;
  56.                            cellRect:   Rect;
  57.                            theCell:    Cell;
  58.                            dataOffset: Integer;
  59.                            dataLength: Integer;
  60.                            theList:    ListHandle);
  61.         VAR
  62.             proc: ProcPtr;
  63.     BEGIN
  64.         proc := ProcPtr(theList^^.refCon);
  65.         IF proc <> nil THEN BEGIN
  66.             CallProc(message, selectCell, cellRect, theCell, dataOffset, dataLength, theList, proc);
  67.         END;
  68.     END; (* StubLDEF *)
  69.  
  70. END.
  71.